/*
 * @lc app=leetcode.cn id=118 lang=cpp
 *
 * [118] 杨辉三角
 */

// @lc code=start
class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> ans;
        if(numRows == 0) return ans;

        vector<int> tmp;
        tmp.push_back(1);
        ans.push_back(tmp);

        for(int i = 1; i < numRows; i++)
        {
            tmp = ans[i - 1];
            vector<int> t;
            t.push_back(1);
            for(int j = 1; j < i; j++)
            {
                t.push_back(tmp[j - 1] + tmp[j]);
            }
            t.push_back(1);
            ans.push_back(t);
        }
        return ans;
    }
};
// @lc code=end

